package i7bac.control;

import i7bac.view.MainFrame;
import i7bac.view.ViewExample;

import java.awt.Color;
import java.awt.Font;

import javax.swing.JButton;

public class Controller {

	private static MainFrame mainFrame;
	
	private final static Font BUTTON_FONT = new Font("Calibri", Font.BOLD, 48);
	
	//TODO
	private static JButton okButton;
	private static JButton backButton;

	/*
	 * Load the product list from a file
	 */
	private static void loadProductList() {
		//TODO
	}
	
	/*
	 * Set the  controls
	 */
	private static void setControls() {
		//TODO OK and BACK buttons
		okButton = new JButton("OK");
		okButton.setFont(BUTTON_FONT);
		okButton.setBackground(Color.green);
		okButton.setFocusable(false);
		backButton = new JButton("BACK");
		backButton.setFont(BUTTON_FONT);
		backButton.setBackground(Color.red);
		backButton.setFocusable(false);
	}
	
	/*
	 * Build the GUI
	 */
	private static void createAndShowGUI() {
		mainFrame = new MainFrame();
		// TODO Example
		mainFrame.addView(new ViewExample(okButton, backButton));
	}
	
	public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
        		loadProductList();
        		setControls();
        		createAndShowGUI();
            }
        });
    }
}
